import {
  ajax
} from "@/config/apiServer/axios-config.js";
import {
  URLS
} from "@/config/apiServer/urls.js";


// 获取快讯列表
export function getNewsList(form) {
  return ajax({
    type: 'get',
    url: URLS.NEWS_URL,
    params: form
  })
}

// 添加快讯
export function addNews(form) {
  return ajax({
    type: 'post',
    url: URLS.NEWS_URL,
    params: form
  })
}

// 删除快讯
export function removeNews(id) {
  return ajax({
    type: 'delete',
    url: URLS.NEWS_URL,
    params: {
      id: id
    }
  })
}

// 编辑快讯
export function updateNews(form) {
  return ajax({
    type: 'put',
    url: URLS.NEWS_URL,
    params: form
  })
}

//快讯详情
export function getNewsDetail(id) {
  return ajax({
    type: 'get',
    url: URLS.NEWS_URL,
    params: {
      id: id
    }
  })
}

//文章列表
export function getArticlesList(form) {
  return ajax({
    type: 'get',
    url: URLS.ARTICLES_LIST,
    params: form
  })
}

// 添加文章
export function addArticles(form) {
  return ajax({
    type: 'post',
    url: URLS.ARTICLES_URL,
    params: form
  })
}

// 删除文章
export function removeArticles(id) {
  return ajax({
    type: 'delete',
    url: URLS.ARTICLES_URL,
    params: {
      id: id
    }
  })
}

// 编辑文章
export function updateArticles(form) {
  return ajax({
    type: 'put',
    url: URLS.ARTICLES_URL,
    params: form
  })
}

//快讯详情
export function getArticlesDetail(id) {
  return ajax({
    type: 'get',
    url: URLS.ARTICLES_URL,
    params: {
      id: id
    }
  })
}

//图片上传
export function upload(formData) {
  return ajax({
    type: 'post',
    url: URLS.UPLOAD,
    params: formData
  })
}







